<?php

require_once('Myzen/Oauth/Signaturemethod.php');

class Myzen_Oauth_SignatureMethod_PLAINTEXT extends Myzen_Oauth_Signaturemethod {
  public function get_name() {
    return "PLAINTEXT";
  }

  public function build_signature($request, $consumer, $token) {
    $sig = array(
      Myzen_Oauth_Util::urlencode_rfc3986($consumer->secret)
    );

    if ($token) {
      array_push($sig, Myzen_Oauth_Util::urlencode_rfc3986($token->secret));
    } else {
      array_push($sig, '');
    }

    $raw = implode("&", $sig);
    // for debug purposes
    $request->base_string = $raw;

    return Myzen_Oauth_Util::urlencode_rfc3986($raw);
  }
}